import { findUserInfo } from '@/api/common'
import { computed } from 'vue'

export const getUserInfo = () => {
  return new Promise((resolve) => {
    findUserInfo().then((res) => {
      const result = res.result
      // 更新 form 初始化 giveStaffId
      resolve({
        employeeId: result.employeeId,
        employeeName: result.realname,
      })
    })
  })
}
// 订单是否是手动维护订单
export const orderIsMaintenance = (orderInfo = {}) => {
  const { orderSource, channelOrderMaintenance } = orderInfo
  // 渠道订单
  if (orderSource == 2) {
    return channelOrderMaintenance == 2
  } else {
    // 线下订单均为手动维护订单
    return true
  }
}

// 订单是否是手动维护订单
export const operaOrderMaintenance = (orderInfo = {}) => {
  const isShow = computed(() => {
    if (orderInfo.orderSource == 2) {
      return orderInfo.channelOrderMaintenance == 2
    }
    // 线下订单均为手动维护订单
    return true
  })
  return isShow
}
